﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace School
{
    class Student
    {
        public Student(string name, int facultyNumber)
        {
            if (name.Equals(String.Empty))
            {
                throw new ArgumentException("Name cannot be empty");
            }

            if (facultyNumber < 10000 || facultyNumber > 99999)
            {
                throw new ArgumentException("Faculty Number must be in the interval [10000, 99999]");
            }

            this.name = name;
            this.facultyNumber = facultyNumber;
        }

        public string Name
        {
            get
            {
                return name;
            }
        }

        public int FacultyNumber
        {
            get
            {
                return facultyNumber;
            }
        }

        public override bool Equals(object obj)
        {
            Student s = obj as Student;

            if (s == null)
            {
                return false;
            }

            return Name.Equals(s.Name) && FacultyNumber == s.FacultyNumber;
        }

        public override int GetHashCode()
        {
            return Name.GetHashCode() ^ FacultyNumber.GetHashCode();
        }

        private string name;
        private int facultyNumber;
    }

    class Course
    {
        private const int MAX_STUDENTS = 30;

        public Course()
        {
            students = new HashSet<Student>();
        }

        public void AddStudent(Student student)
        {
            if (students.Contains(student))
            {
                throw new ArgumentException("Student already enrolled in this course");
            }

            if (students.Count >= MAX_STUDENTS)
            {
                throw new ArgumentException("Students in the course cannot be more than 30");
            }

            students.Add(student);
        }

        public void RemoveStudent(Student student)
        {
            if (students.Contains(student))
            {
                students.Remove(student);
                return;
            }

            throw new ArgumentException("Student not found");
        }

        private HashSet<Student> students;
    }

    class School
    {
        static void Main(string[] args)
        {
        }
    }
}
